package com.shrct.businessprocess.purchase.impl;

import com.shrct.businessprocess.budget.RCCostBreakDown;
import com.shrct.businessprocess.product.RCProductMetaType;
import com.shrct.businessprocess.project.RCProjectMoney;
import com.shrct.businessprocess.purchase.RCNormalProductPurchaseBudget;
import com.shrct.businessprocess.purchase.impl.RCBaseProductPurchaseBudgetImpl;
import com.shrct.businessprocess.purchase.proxy.RCNormalProductPurchaseBudgetProxy;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@Entity
@DiscriminatorValue("RCNORMALPRODUCTPURCHASEBUDGET_TYPE")
public class RCNormalProductPurchaseBudgetImpl extends RCBaseProductPurchaseBudgetImpl implements RCNormalProductPurchaseBudget {
  public RCNormalProductPurchaseBudgetImpl() {
    super();
  }
  
  public RCNormalProductPurchaseBudgetImpl(final RCCostBreakDown cbd) {
    super( cbd);
    
  }
  
  @Embedded
  @AttributeOverrides(value = { @AttributeOverride(name = "amount", column = @Column(name = "contractPrice_amount") ), @AttributeOverride(name = "workaround", column = @Column(name = "contractPrice_workaround") ) } )
  @AssociationOverrides(value = @AssociationOverride(name = "exchange", joinColumns = @JoinColumn(name = "contractPrice_exchange") ) )
  private RCProjectMoney contractPrice = com.shrct.businessprocess.project.RCProjectMoney.create();
  
  public RCProjectMoney getContractPrice() {
    return this.contractPrice;
  }
  
  public RCNormalProductPurchaseBudget setContractPrice(final RCProjectMoney contractPrice) {
    this.contractPrice = contractPrice;
    return this;			
    
  }
  
  private Double contractTaxRate;
  
  public Double getContractTaxRate() {
    return this.contractTaxRate;
  }
  
  public RCNormalProductPurchaseBudget setContractTaxRate(final Double contractTaxRate) {
    this.contractTaxRate = contractTaxRate;
    return this;			
    
  }
  
  @Embedded
  @AttributeOverrides(value = { @AttributeOverride(name = "amount", column = @Column(name = "netPrice_amount") ), @AttributeOverride(name = "workaround", column = @Column(name = "netPrice_workaround") ) } )
  @AssociationOverrides(value = @AssociationOverride(name = "exchange", joinColumns = @JoinColumn(name = "netPrice_exchange") ) )
  private RCProjectMoney netPrice = com.shrct.businessprocess.project.RCProjectMoney.create();
  
  public RCProjectMoney getNetPrice() {
    return this.netPrice;
  }
  
  public RCNormalProductPurchaseBudget setNetPrice(final RCProjectMoney netPrice) {
    this.netPrice = netPrice;
    return this;			
    
  }
  
  private Double netTaxRate;
  
  public Double getNetTaxRate() {
    return this.netTaxRate;
  }
  
  public RCNormalProductPurchaseBudget setNetTaxRate(final Double netTaxRate) {
    this.netTaxRate = netTaxRate;
    return this;			
    
  }
  
  private String name;
  
  public String getName() {
    return this.name;
  }
  
  public RCNormalProductPurchaseBudget setName(final String name) {
    this.name = name;
    return this;			
    
  }
  
  public String getTypeId() {
    return "RCAYBudget";
  }
  
  public RCProductMetaType getProductMetaType() {
    return RCProductMetaType.normalProduct;
  }
  
  public static RCNormalProductPurchaseBudget create(final RCCostBreakDown cbd, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.purchase.RCNormalProductPurchaseBudget rCNormalProductPurchaseBudget = new com.shrct.businessprocess.purchase.impl.RCNormalProductPurchaseBudgetImpl(
    	cbd
    );
    objectFactory.create(rCNormalProductPurchaseBudget);
    return rCNormalProductPurchaseBudget;			
    
  }
  
  public static RCNormalProductPurchaseBudget createRCNormalProductPurchaseBudgetImpl(final RCCostBreakDown cbd, final IObjectFactory objectFactory, final Procedure1<RCNormalProductPurchaseBudget> init) {
    com.shrct.businessprocess.purchase.RCNormalProductPurchaseBudget rCNormalProductPurchaseBudget = new com.shrct.businessprocess.purchase.impl.RCNormalProductPurchaseBudgetImpl(
    	cbd
    );
    objectFactory.create(rCNormalProductPurchaseBudget);
    init.apply(rCNormalProductPurchaseBudget);
    
    return rCNormalProductPurchaseBudget;			
    
  }
  
  public RCNormalProductPurchaseBudgetProxy toProxy() {
    com.shrct.businessprocess.purchase.proxy.RCNormalProductPurchaseBudgetProxy proxy = new com.shrct.businessprocess.purchase.proxy.RCNormalProductPurchaseBudgetProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
